from utils.pd_show_utils import df_table
from ..base import BaseCrawler
import pandas as pd
import qstock as qs

class Spider_qs_stock_parser(BaseCrawler):
    def __init__(self, name,url, data_process_type,params):
        super().__init__(name,url,data_process_type, params)

    def fetch_one(self,item):
        stock_id = item['正股代码']
        method_name = self.url
        method = getattr(qs, method_name)
        pd_result = method(stock_id)
        return stock_id, pd_result

    def parse(self, raw_data):
        """解析原始数据"""
        return raw_data